#pragma once

/*!
 * \brief Template class to make derived classes have only one instance
 *
 * Template class to make derived classes have only one instance
 *
 * \author Jorge Barrio
 */
#include "FLOW_core/namespace.h"

namespace CORE
{

	template< typename T >
	class Singleton
	{
	private:
		//============================= METHODS ===================================
		//! Default constructor
		Singleton( ) {}

		//! Destructor
		~Singleton( ) {}

		//! Copy constructor
		Singleton( const Singleton& ar_singleton );

		//! Assignement operator
		Singleton& operator = ( const Singleton& ar_singleton );

		friend T;

	public:
		//============================= METHODS ===================================
		//! Returns a reference to the unique instance of the singleton
		static T& GetInstance( void )
		{
			static T sg_singleton;

			return sg_singleton;
		}
	};

} //namespace CORE